<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>友链列表</title>
  <!--  公共头部-->
  <div th:replace="admin/common :: head"></div>
</head>
<body>


<!--公共导航-->
<div th:replace="admin/common :: menu(3)"></div>

  <div class="m-padded-tb-hugex">
  <div class="ui attached pointing menu">
    <div class="ui container">
      <div class="right menu">
        <a href="#" class="item">新增</a>
        <a href="#" th:href="@{/admin/friend}" class="teal active item">列表</a>
      </div>
    </div>
  </div>
  </div>

  <!--中间内容-->
  <div  class="m-padded-tb-big">
    <div class="ui container">
      <!--消息提示-->
      <div class="ui success message" >
        <i class="close icon"></i>
        <div th:text="|提示：${messages}" class="" >提示：恭喜，操作成功！</div>
      </div>
      <table class="ui compact teal table">
        <thead>
          <tr align="center">
            <th>ID</th>
            <th>博客名称</th>
            <th>博客地址</th>
            <th>图片地址</th>
            <th>添加时间</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <tr th:each="friend,stats:${pager.datas}" align="center" >
            <td th:text="${stats.count}">1</td>
            <td th:text="${friend.fname}">ONESTAR</td>
            <td th:text="${friend.address}">https://onestar.newstar.net.cn/</td>
            <td th:text="${friend.img}">https://onestar.newstar.net.cn/</td>
            <td th:text="${friend.formateTime(friend.create_time)}">2020-01-02 09:45</td>
            <!--th:text="${#dates.format(message.createTime,'yyyy-MM-dd HH:mm')}"-->
            <td>
              <a href="#" th:href="@{/admin/friend/modify(friendId=${friend.friendId})}" class="ui mini teal basic button">编辑</a>
              <a href="#" th:href="@{/admin/friend/delete(friendId=${friend.friendId})}" onclick="return confirm('确定要删除该友链吗？三思啊! 删了可就没了！')" class="ui mini red basic button">删除</a>
            </td>
          </tr>
        </tbody>
        <tfoot>
          <tr>
            <th colspan="6" >
              <div class="ui inverted divided stackable grid">
                <div class="three wide column" align="center">
                  <a th:if="${pager.has_pre}" th:href="@{/admin/friend}" class="item">首页</a>&nbsp;&nbsp;&nbsp;
                  <a th:if="${pager.has_pre}" th:href="@{/admin/friend(page=${pager.page}-1)}" class="item">上一页</a>
                </div>

                <div class="ten wide column" align="center">
                  <p>第 <span th:text="${pager.page}"></span> 页，共 <span th:text="${pager.pages}"></span> 页，有 <span th:text="${pager.size}"></span> 个链接</p>
                </div>

                <div class="three wide column" align="center">
                  <a th:if="${pager.has_next}" th:href="@{/admin/friend(page=${pager.page}+1)}" class="item">下一页</a>&nbsp;&nbsp;&nbsp;
                  <a th:if="${pager.has_next}" th:href="@{/admin/friend(page=${pager.last})}" class="item">末页</a>
                </div>
              </div>

              <div align="center">
                <a href="#" th:href="@{/admin/friend/input}">
                  <button type="button" class="ui teal button m-mobile-wide m-margin-top"><i class="pencil icon"></i>新增</button>
                </a>
              </div>

            </th>
          </tr>
        </tfoot>
      </table>
    </div>
  </div>

  <br>
  <br>
<br>
<br>
<br>
<!--公共底部栏-->
<div th:replace="admin/common :: #footer"></div>

<!--公共js-->
<div th:replace="admin/common :: #js"></div>

  <script>
    $('.menu.toggle').click(function () {
      $('.m-item').toggleClass('m-mobile-hide');
    });

    $('.ui.dropdown').dropdown({
      on : 'hover'
    });

    //消息提示关闭初始化
    $('.message .close')
      .on('click', function () {
        $(this)
          .closest('.message')
          .transition('fade');
      });
  </script>
</body>
</html>